package com.special.threademo.concurrency.executorsDemo;

import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.stream.IntStream;

/**
 * Created with IDEA2020.3
 * author:LiuYC
 * DateTime:2021/1/20  14:41
 */
public class TestDemo1 {
    public static void main(String[] args) {
        ExecutorService executorService = Executors.newFixedThreadPool(3);
        IntStream.range(0, 9).forEach(i -> {
            executorService.submit(() -> {
                IntStream.range(0, 50).forEach(j -> {
                    System.out.println(Thread.currentThread().getName());
                });
            });
            executorService.shutdown();
        });
    }

}
